module et {
    const headPos: number = 50;
    export class IdGenerater {
        private static instanceIdGenerator=Long.fromNumber(0);

        private static _appId: Long=Long.fromNumber(0);
        static get appId(): Long {
            return IdGenerater._appId;
        }
        static set appId(value: Long) {
            IdGenerater._appId = value;
            IdGenerater.instanceIdGenerator = value.shiftLeft(48);
        }
        private static value=0;
        static GenerateId(): Long {
            return IdGenerater._appId.shiftLeft(48).add(Long.fromNumber(Date.now()/1000).shiftLeft(16)).add(++this.value);
        }
        static GenerateInstanceId(): Long {
            IdGenerater.instanceIdGenerator=IdGenerater.instanceIdGenerator.add(1);
            return Long.fromValue(IdGenerater.instanceIdGenerator);
        }
    }
}